package com.meetingshow.meeting.service.util;

import java.util.Map;

import org.apache.commons.lang.StringUtils;

import com.meetingshow.common.base.dao.model.QueryStruct;
import com.meetingshow.common.base.service.BaseQueryParasBuilder;
import com.meetingshow.meeting.service.model.TopicQueryParas;

public class TopicQueryParasBuilder extends BaseQueryParasBuilder {
    public static QueryStruct topicQueryBuilder(QueryStruct queryStruct,
            TopicQueryParas topicQueryParas) throws Exception {

        builderInit(topicQueryParas, queryStruct);

        Map<String, Object> exactMap = queryStruct.getExactMap();
        Map<String, String> mistinessMap = queryStruct.getMistinessMap();

        if (StringUtils.isNotBlank(topicQueryParas.getTopicId_e())) {
            exactMap.put(TopicServiceParas.TOPIC_PO_ID,
                    Integer.valueOf(topicQueryParas.getTopicId_e()));
        }

        if (StringUtils.isNotBlank(topicQueryParas.getTopicName_e())) {
            exactMap.put(TopicServiceParas.TOPIC_PO_NAME,
                    topicQueryParas.getTopicName_e());
        }

        if (StringUtils.isNotBlank(topicQueryParas.getTopicName())) {
            mistinessMap.put(TopicServiceParas.TOPIC_PO_NAME,
                    topicQueryParas.getTopicName());
        }

        if (StringUtils.isNotBlank(topicQueryParas.getMeetingId_e())) {
            exactMap.put(TopicServiceParas.TOPIC_PO_MEETING_ID,
                    Integer.valueOf(topicQueryParas.getMeetingId_e()));
        }

        pageBuilder(queryStruct, topicQueryParas);

        return queryStruct;
    }
}
